
/**
 * 
 * @param url
 * @param requestData
 * @param callback
 */
function ajaxPost(url, requestData, callback) {
	$.post(url, requestData, function(response) {
		interceptAjaxResponse(response, callback);
	});
}

/**
 * 
 * @param url
 * @param requestData
 * @param callback
 */
function ajaxGet(url, requestData, callback) {
	$.get(url, requestData, function(response) {
		interceptAjaxResponse(response, callback);
	});
}

/**
 * 
 * @param data
 * @param callback
 */
function interceptAjaxResponse(data, callback) {
	
	if (callback != null) {
		callback(data);
	}
};

function interceptAjaxJson(data, key, callback) {
	if (callback != null) {
		var status = data.status;
		var exception = data.exception;
		if (status == 200) {
			if (exception != null) {
				alert(exception);
			} else {
				callback(data[key]);
			}
		} else {
			alert("系统错误");
		}
	}
};

function ajaxQueryJson(url, requestData, callback) {
	$.getJSON(url, requestData, function(response) {
		interceptAjaxJson(response, "recordset", callback);
	});
}